<?php
class ome_finder_order_fail{
    var $detail_fail = '货品修正';

    function detail_fail($order_id){
        $render = app::get('ome')->render();
        $oOrder = app::get('ome')->model('orders');

        $orderInfo = $oOrder->dump($order_id , '*' , array('order_objects' => array('*',array('order_items' => array('*')))));
        //echo "<pre>";
        //var_dump($orderInfo['order_objects']);
        foreach($orderInfo['order_objects'] as $ko => &$obj){
            if($obj['goods_id'] <=0){
                //销售物料找不到的
                $obj['obj_fail'] = 1;
                continue;
            }

            if(!isset($obj['order_items'])){
                $obj['obj_item_fail'] = 1;
            }
        }

        $shopex_shop_list = ome_shop_type::shopex_shop_type();
        $shops = app::get('ome')->model('shop')->dump(array('shop_id'=>$orderInfo['shop_id']),'node_type');
        $render->pagedata['shop_type'] = in_array($shops['node_type'],$shopex_shop_list) ? 'shopex' : 'c2c';
        $render->pagedata['orderInfo'] = $orderInfo;
        $render->pagedata['object_alias'] = $oOrder->getOrderObjectAlias($order_id);
        return $render->fetch('admin/order/detail_fail.html');
    }
}